package com.cq.smartelebicycle;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class DataManger {
	private SharedPreferences mPreferences;
	private SharedPreferences.Editor editor;
	private static final String PREFERENCES_NAME = "smartelebicycle";

	private static final String ACCOUNT = "account";
	private static final String FACTORY_STATE = "state";

	public DataManger(Context context) {
		mPreferences = context.getSharedPreferences(PREFERENCES_NAME,
				Context.MODE_PRIVATE);
		editor = mPreferences.edit();
	}

	public void storeFactoryPswState(boolean state) {

		editor.putBoolean(FACTORY_STATE, state);
		editor.commit();
	}

	public boolean getFactoryPswState() {
		boolean state = mPreferences.getBoolean(FACTORY_STATE, false);
		return state;
	}

	public void storeUserPsw(String psw) {
		editor.putString(ACCOUNT, psw);
		editor.commit();
	}

	public String getUserPsw() {
		String account = mPreferences.getString(ACCOUNT, null);
		return account;
	}
	
}
